using System.Web.Mvc;
using ExtendedMvc.Html;

namespace ExtendedMvc.Elements {
	public class ListItem : ListItemBase<ListItem> {
		public ListItem(string content, string id = null) : base(content, id) { }
	}

	public abstract class ListItemBase<T> : VisibleElement<T> where T : ListItemBase<T> {

		protected object content { get; private set; }

		protected ListItemBase(string content, string id = null) 
			: base(HtmlTag.ListItem, id) {
			Content(content);
		}

		public virtual T Content(object value) {
			this.content = value;
			return (T)this;
		}

		protected override TagRenderMode TagRenderMode { get { return TagRenderMode.Normal; } }

		protected override void Prepare() {
			base.Prepare();
		}

		protected override void SetContent() {
			if (content == null) return;
			Builder.InnerHtml = content.ToString();
		}
	}
}